package com.shxy.rlzy.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shxy.rlzy.entity.EmployeeInfo;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author tanhao
 * @since 2021-09-23
 */
public interface EmployeeInfoMapper extends BaseMapper<EmployeeInfo> {

    /**
     * 查询全部员工信息
     * @return
     */
    @Select("select * from emp_info")
    List<EmployeeInfo> getAll();

    /**
     * 根据身份证号码查询员工id
     * @param idCard
     * @return
     */
    @Select("SELECT id FROM emp_info WHERE idcard = #{idCards}")
    Long getIdByIdCard(String idCard);

    /**
     * 根据身份证列表查询员工id列表
     * @param idCards
     * @return
     */
    @Select("SELECT id FROM emp_info WHERE idcard in #{idCards}")
    List<Long> getIdsByIdCards(List<String> idCards);

    /**
     * 删除员工
     * @param id
     */
    @Update("UPDATE emp_info SET statu=-1 WHERE id=#{id}")
    int removeById(Long id);
}
